/*
 * @Description: 
 * @Autor: 万洲
 * @Date: 2022-10-11 11:00:44
 * @LastEditors: 万洲
 * @LastEditTime: 2022-11-23 15:54:24
 */
import { defineComponent, onMounted, ref, getCurrentInstance } from 'vue';
import { RouterView } from 'vue-router';
import "@/assets/css/index.scss"
import { useCssVar } from "@vueuse/core"
import config from './constants/config';
import useUserStore from './store/useUserStore';
import router from './router';
import { ElConfigProvider } from 'element-plus';
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import { useElementPlusTheme } from "@/utils/elementTheme/index"
import 'element-plus/dist/index.css'
export default defineComponent({
    name: 'App',
    setup(props, context) {
        const userStore = useUserStore()
        document.title = config.webTitle
        const defaultTheme = ref('#1899ff')
        const instance = getCurrentInstance()

        onMounted(() => {
            const { changeTheme } = useElementPlusTheme(defaultTheme.value)
            // changeTheme("#E7196B")
            // changeTheme("red")
            // if (!userStore.userToken) router.replace("/login")
        })


        return () => (
            <>
                <div style={{ backgroundColor: "#F0F2F5", margin: "0 auto", height: "100vh", minWidth: "800px" }}>
                    <ElConfigProvider locale={zhCn}>
                        <RouterView />
                    </ElConfigProvider>
                </div>
            </>
        );
    }
});